<%@ page import="entity.User" %>
<%@ page import="entity.Plate" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="Impl.adminDaoImpl" %>
<%@ page import="entity.Admin" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>用户首页</title>
    <!-- Bootstrap -->
</head>

<script type="text/javascript">

    $(function () {
        $.get("/showBlockAjax", {},function (data, status) {
            // console.log(data);
            $('.module').html(data);
        })
    })
</script>
<body>
<%--<div class="top-bar" style="height: 50px;width: 100%;background-color:#242729;font-size: 23px;color: white;padding-top: 5px">--%>
<%--    <span style="margin-left: 20px;">论坛首页</span>--%>
<%--</div>--%>
<%@include file="header.jsp"%>
<%request.setCharacterEncoding("utf-8");%>
<%@include file="user_menubar.jsp"%>
<div class="content-wrapper">
    <div class="main">
        <div class="title">
            <h2><span><img src="img/comments-icon.png" style="width: 25px; height: 20px"></span>所有版块</h2>
        </div>
        <div class="module">
            <%
                ArrayList<Plate> sectionInfoList = (ArrayList<Plate>) request.getSession().getAttribute("sectionInfoList");
                ArrayList<Plate> rootSectionInfoList = (ArrayList<Plate>) request.getSession().getAttribute("rootSectionInfoList");
                ArrayList<Plate> childSectionInfoList = (ArrayList<Plate>) request.getSession().getAttribute("childSectionInfoList");
                if (sectionInfoList != null) {
                    for (int i = 0; i < sectionInfoList.size(); i++) {
            %>
            <div class=item>
                <a href="showchildblock.jhtml?sid=<%=sectionInfoList.get(i).getSid()%>&sname='<%=sectionInfoList.get(i).getsName()%>'">
                    <img src='static/img/head/1.gif'>
                </a>
                <span><a href="showchildblock.jhtml?sid=<%=sectionInfoList.get(i).getSid()%>&sname='<%=sectionInfoList.get(i).getsName()%>'"><%=sectionInfoList.get(i).getsName()%></a></span>
                <p>
                    共有<span><%=sectionInfoList.get(i).getsTopicCount()%></span>个帖子 &nbsp;
                    <%
                        int masterid = sectionInfoList.get(i).getsMasterId();
                        Admin admin = new adminDaoImpl().findAdminByID(masterid);
                    %>
                    版主：<a class=block-admin onClick="show_info('管理员信息','admin-info.jsp?name=<%=admin.getAname()%>','600','370')"><%=admin.getAname()%></a></p>
                <p>
                    上次更新 <span><%=sectionInfoList.get(i).getsTime()%></span>
                </p><br/>
            </div>
            <%  }
            }%>
        </div>
    </div>
</div>

<%@include file="footer.jsp"%>
</body>
</html>